@extends('admin.layout.main')

@section('content')
    <div class="breadcrumbs ace-save-state" id="breadcrumbs">
        <ul class="breadcrumb">
            <li>
                <i class="ace-icon fa fa-home home-icon"></i>
                <a href="#">首页</a>
            </li>
            <li class="active"><a href="{{ url('admin/user_list') }}">会员管理</a></li>
            <li class="active"><a href="{{ url('admin/add_user') }}">添加会员</a></li>
        </ul><!-- /.breadcrumb -->

        <div class="nav-search" id="nav-search">
            <form class="form-search">
		<span class="input-icon">
		<input type="text" placeholder="Search ..." class="nav-search-input" id="nav-search-input" autocomplete="off" />
			<i class="ace-icon fa fa-search nav-search-icon"></i>
		</span>
            </form>
        </div><!-- /.nav-search -->
    </div>

    <div class="row">
        <div class="col-xs-12">
            <!-- PAGE CONTENT BEGINS -->
            <form class="form-horizontal" role="form" action="/admin/update_user" method="post" enctype="multipart/form-data">
                <table id="dynamic-table" class="table table-striped table-bordered table-hover">
                    <tbody>
                    <tr>
                        <td class="center">
                            <span >* 电子邮箱或手机号</span>
                            <input type="hidden" name="_token" value="{{csrf_token()}}"/>

                        </td>
                        <td>
                            @if(empty($user_name->email))
                            <input type="text" name="account" class="col-xs-10 col-sm-5" value="{{$user_name->phone}}">
                            @else
                            <input type="text" name="account" class="col-xs-10 col-sm-5" value="{{$user_name->email}}">
                            @endif
                        </td>
                    </tr>


                    <tr>
                        <td class="center">
                            <span>* 昵称</span>
                        </td>
                        <td>
                            <input type="text" name="nickname" class="col-xs-10 col-sm-5" value="{{$user_name->nickname}}">
                        </td>
                    </tr>
                    <tr>
                        <td class="center">
                            <span >* 个人头像</span>
                        </td>
                        <td>
                            <img src="{{$user_name->headimg}}">
                        </td>
                    </tr>
                    <tr>
                        <td class="center">
                            <span>* 个人头像上传</span>
                        </td>
                        <td>
                            <input type="file" name="logo">
                        </td>
                    </tr>
                    <tr>
                        <td class="center">
                            <span>* 可用资产</span>
                        </td>
                        <td>
                            @foreach($data as $key=>$val)
                            <span>{{$val['name_en']}}</span>:<span>{{$val['balance']}}</span>
                                &nbsp;&nbsp;&nbsp;
                                @endforeach
                        </td>
                    </tr>
                    <tr>
                        <td class="center">
                            <span>* 冻结资产</span>
                        </td>
                        <td>
                            @foreach($data as $key=>$val)
                                <span>{{$val['name_en']}}</span>:<span>{{$val['blocked']}}</span>
                                &nbsp;&nbsp;&nbsp;
                            @endforeach
                        </td>
                    </tr>
                    <tr>
                        <td class="center">
                            <span>* 登录密码</span>
                        </td>
                        <td>
                            <input type="password" name="password" class="col-xs-10 col-sm-5" >&nbsp;<span style="color: red">输入则修改，不输入为原密码</span>
                        </td>
                    </tr>
                    <tr>
                        <td class="center">
                            <span>* 交易密码</span>
                        </td>
                        <td>
                            <input type="password" name="pay_pass" class="col-xs-10 col-sm-5">&nbsp;<span style="color: red">输入则修改，不输入为原密码</span>
                        </td>
                    </tr>
                    <tr>
                        <td class="center">
                            <span>* 实名认证</span>
                        </td>
                        <td>
                        @if($user_name->real_status == 2)
                            <span class="btn btn-info">已认证</span>
                                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span>真实姓名：</span><span>{{$real_name->name}}</span>
                                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span>身份证号：</span><span>{{$real_name->indentity_card}}</span>
                        @elseif($user_name->real_status == 1)
                                <a href="/admin/check_user_info?id={{$user_name->id}}"><span class="btn btn-info">添加实名认证</span></a>
                        @elseif($user_name->real_status == 3)
                                <span class="btn btn-info">审核中</span>
                                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span>真实姓名：</span><span>{{$real_name->name}}</span>
                                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span>身份证号：</span><span>{{$real_name->indentity_card}}</span>
                            @elseif($user_name->real_status == 4)
                                <span class="btn btn-info">审核失败</span>
                                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span>真实姓名：</span><span>{{$real_name->name}}</span>
                                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span>身份证号：</span><span>{{$real_name->indentity_card}}</span>
                                <a href="/admin/check_user_info?id={{$user_name->id}}"><span class="btn btn-info">修改实名认证</span></a>
                        @endif
                            </td>
                        <input type="hidden" name="id" value="{{$user_name->id}}">
                    </tr>
                    @if($user_name->real_status != 1)

                        <tr>
                        <td class="center">
                            <span>* 身份证正面</span>
                        </td>
                        <td>
                            <img name="front_photo" src="{{$real_name->front_card}}" width="200" height="100">
                        </td>
                    </tr>
                    <tr>
                        <td class="center">
                            <span>* 身份证背面</span>
                        </td>
                        <td>
                            <img name="back_card" src="{{$real_name->back_card}}" width="200" height="100">
                        </td>
                    </tr>
                        <tr>
                            <td class="center">
                                <span>* 手持身份证</span>
                            </td>
                            <td>
                                <img name="back_card" src="{{$real_name->hand_card}}" width="200" height="100">
                            </td>
                        </tr>
                    @endif

                    <tr>
                        <td>
                            <span></span>
                        </td>
                        <td>
                            <button class="btn btn-info" type="submit" >
                                <i class="ace-icon fa fa-check bigger-110"></i>
                                提交
                            </button>

                            &nbsp; &nbsp; &nbsp;
                            <a href="/admin/user_list" class="btn" type="reset">
                                <i class="ace-icon fa fa-undo bigger-110"></i>
                                返回
                            </a>
                        </td>
                    </tr>
                    </tbody>
                </table>
            </form>
        </div>
    </div>
    </div><!-- /.main-content -->
    <script>


//        function on_add() {
//            var formData = new FormData($('form')[0]);
//            formData.append('file',$(':file')[0].files[0]);
//            console.log(formData);
//            $.ajax({
//                type : "POST",
//                url:'/admin/update_user',
//                data : {a:1},
//                success: function(res){
//                    if(res.status == 1){
//                        layer.msg('修改成功',{icon:1})
////                            location.href= '/user/index'
//                        location.href= '/admin/user_list'
//                    }else{
//                        layer.msg(res.msg, {icon: 2});
//                    }
//                }
//            });
//        }

    </script>
@endsection
